﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;

using Best.Framework.DALFactory;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Common;


namespace SkWeb.Handlers
{
    public partial class ConstDictHandler : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string resultJson = "[]";
            try
            {
                string cstType = Request.QueryString["cst_type"];

                string key = string.Concat("cst_dict_", cstType);
                
                DataTable dictTable = DataCache.GetCache(key) as DataTable;

                if (dictTable == null)
                {
                    TB_CST_INFO_BLL cstBLL = new TB_CST_INFO_BLL();
                    dictTable = cstBLL.QueryConstItems(cstType);
                    DataCache.SetCache(key, dictTable);
                }

                resultJson = JsonHelper.ToJson(dictTable);
            }
            catch (Exception ex)
            {
            	
            }
            finally
            {
                Response.ContentType = "text/json";
                Response.Write(resultJson);
            }
            
        }
    }
}